﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace DingChiServiceApp
{
    public class DuplicateHelper
    {
        public static Duplicate Create(HaulBill bill)
        {
            if (bill == null) return null;

            var duplicte = new Duplicate()
            {
                id = bill.id,
                duplicateId = bill.duplicateId,
                duplicateCode = bill.serial,
                productionEnterpriseId = bill.sendFirmID,
                productionEnterpriseName = bill.sendFirm,
                productionEnterprisePhone = bill.sendPhone,
                productionAgent = bill.sendManager,
                productionSignature = bill.sendStampStatus,

                duplicateDriver = bill.driverName,

                duplicateStatus = bill.status.ToString(),

                disposalEnterpriseId = bill.receiveFirmID,
                disposalEnterpriseName = bill.receiveFirm,
                disposalEnterprisePhone = bill.receivePhone,


                transportEnterpriseId = bill.transportFirmID,
                transportEnterpriseName = bill.transportFirm,
                transportEnterprisePhone = bill.transportPhone,
               // transportAgent = bill.transportManager,
                transportAgent = bill.transportStampUser,
                transportSignature = bill.transportStampStatus,
                transportTime = bill.sendTareTime,
                transportRoutes = bill.routeName,
                transportGrossWeight = bill.sendGrossWeight / 1000,
                transportTareWeight = bill.sendTareWeight / 1000,
                transportNetWeight = bill.sendNetWeight / 1000,

                //transportMoistureContent = 

                //transportPictures = bill.tra

                transportLicensePlate = bill.vehicleNo,

                receiveAgent = bill.receiveManager,
                // receiveSignature = 
                // receiveMoistureContent= 

                receiveGrossWeight = bill.receiveGrossWeight / 1000,
                receiveTareWeight = bill.receiveTareWeight / 1000,
                receiveNetWeight = bill.receiveNetWeight / 1000,
                receiveTime = bill.receiveGrossTime,
                //  receivePictures =

                comDiverAgent = bill.driverName,
                comeLicensePlate = bill.vehicleNo,

                createTime = bill.createTime,
                updateTime = bill.modifyTime,

            };

            if (bill.productName.Equals("污泥"))
            {
                duplicte.transportMoistureContent = " 80";
                duplicte.receiveMoistureContent = "80";
            }
            else
            {
                duplicte.receiveMoistureContent = "60";
                duplicte.transportMoistureContent = " 60";
            }

            return duplicte;
        }
    }
}
